<?php
namespace ulue\web;

/**
 *
 */
class FormModel //extends AnotherClass
{
    protected static $_names = [];

    function __construct($argument)
    {
        # code...
    }

    public function rules()
    {
        return [];
    }

    /**
     * Declares attribute labels.
     */
    public function attrLabels()
    {
        return array(
            // 'name'=>'名称：',
        );
    }

    /**
     * @form Yii 1
     * Returns the list of attribute names.
     * By default, this method returns all public properties of the class.
     * You may override this method to change the default.
     * @return array list of attribute names. Defaults to all public properties of the class.
     */
    public function attrNames()
    {
        $className = get_class($this);

        if(!isset(self::$_names[$className]))
        {
            $class = new \ReflectionClass( $className );
            $names = array();

            foreach($class->getProperties() as $property)
            {
                $name = $property->getName();

                if($property->isPublic() && !$property->isStatic()) {
                    $names[]=$name;
                }
            }

            return self::$_names[$className]=$names;
        }
        else {
            return self::$_names[$className];
        }
    }


    public function textField($name, $text='', array $attrs=[])
    {
        # code...
    }

    public function fileField($name, $text='', array $attrs=[])
    {
        # code...
    }

    public function selectField($name, array $data=[] , array $attrs=[])
    {
        # code...
    }

    public function radioField($name, $text='', array $attrs=[])
    {
        # code...
    }

    public function radioList($name, array $data=[] , array $attrs=[])
    {
        # code...
    }

    public function checkboxField($name,$text='', array $attrs=[])
    {
        # code...
    }

    public function checkboxList($name, array $data=[] , array $attrs=[])
    {
        # code...
    }

    public function dropDownList($name, array $data=[] , array $attrs=[])
    {
        # code...
    }

    public function submitField($name, $text='', array $attrs=[])
    {
        # code...
    }

    public function passwordField($name, $text='', array $attrs=[])
    {
        # code...
    }

    public function textareaField($name, $text='', array $attrs=[])
    {
        # code...
    }
}